package com.ccb.sc.common.modules.common.service.impl;

//import com.baidu.ueditor.ActionEnter;
import com.ccb.sc.common.modules.common.service.IUeditorService;
import org.springframework.stereotype.Service;
import org.springframework.util.ClassUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ken
 * @version 1.0
 * @date 2020-09-15
 */
@Service
public class IUeditorServiceImpl implements IUeditorService {

    @Override
    public void ueditor(HttpServletRequest request, HttpServletResponse response) throws IOException {
        request.setCharacterEncoding("utf-8");
        response.setHeader("Content-Type", "text/html");
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with,Authorization,Content-Type");
        response.setHeader("Access-Control-Allow-Credentials", "true");
        String rootPath = ClassUtils.getDefaultClassLoader().getResource("").getPath();
        request.getInputStream();
       // response.getOutputStream().write(new ActionEnter(request, rootPath).exec().getBytes());
    }
}
